-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix(query-core): avoid throwing promise errors when data exists #10025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 054149f The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThe PR fixes error boundary behavior in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-11-22T09:06:05.219ZApplied to files:
🧬 Code graph analysis (1)packages/react-query/src/__tests__/useQuery.promise.test.tsx (1)
🔇 Additional comments (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 054149f
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10025 +/- ##
===========================================
+ Coverage 45.84% 59.62% +13.77%
===========================================
Files 200 129 -71
Lines 8526 5738 -2788
Branches 1983 1578 -405
===========================================
- Hits 3909 3421 -488
+ Misses 4157 2000 -2157
+ Partials 460 317 -143 🚀 New features to boost your workflow:
|
|
🎉 This PR has been released! Thank you for your contribution! |
🎯 Changes
Fixes: #9938
experimental_prefetchInRenderpromise rejection behavior with Suspense defaults.useInfiniteQuery).🧠 Motivation
useSuspenseInfiniteQueryonly throws to the Error Boundary when there is no data to show. However,useInfiniteQuerycombined withexperimental_prefetchInRenderwas rejecting the promise even when data existed (e.g. page 2 fetch errors), which made Error Boundary appear unexpectedly. This change makes both paths consistent.🔧 Implementation Notes
packages/query-core/src/queryObserver.ts.packages/react-query/src/__tests__/useQuery.promise.test.tsxto ensure refetch/page errors with existing data do not throw to Error Boundary.🧪 Testing
✅ Checklist
📷 Optional Evidence
Before: fetch next page error triggers Error Boundary

After: fetch next page error does not trigger Error Boundary;

isFetchNextPageError: trueis shownSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.